<?php
Foo::aStaticMethod();
$classname = 'Foo';
$classname::aStaticMethod();
print $classname::$my_static . "\n";
Foo::method([
    'foo' => 'bar',
    'bar' => 'foo',
    'foobar' => 'barfoo',
    'barfoo' => 'foobar'
]);
MyClass::$aStaticProp;
MyClass::$aStaticProp = 1;
$classname::$aStaticProp;
MyClass::$$b;

class Foo
{
    public static $my_static = 'foo';

    public function staticValue() {
        return self::$my_static;
    }
}

class Bar extends Foo
{
    public function fooStatic() {
        return parent::$my_static;
    }
}

abstract class DataRecord {
    private static $db; // MySQLi-Connection, same for all subclasses
    private static $table = array(); // Array of tables for subclasses

    public static function init($classname, $table, $db = false) {
        if (!($db === false)) self::$db = $db;
        self::$table[$classname] = $table;
    }

    public static function getDB() { return self::$db; }
    public static function getTable($classname) { return self::$table[$classname]; }
}

abstract class Singleton {

    protected static $_instance = NULL;

    /**
     * Prevent direct object creation
     */
    final private function  __construct() { }

    /**
     * Prevent object cloning
     */
    final private function  __clone() { }

    /**
     * Returns new or existing Singleton instance
     * @return Singleton
     */
    final public static function getInstance(){
        if(null !== static::$_instance){
            return static::$_instance;
        }
        static::$_instance = new static();
        return static::$_instance;
    }

}

MyClass::$table[$classname] = 1;

$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();

class Foo {
    public static function staticFoo() {
        static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
        static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
        static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
        static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
    }

    public static function selfFoo()
    {
        self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
        self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
        self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
        self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
    }

    public static function parentFoo()
    {
        parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
        parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty;
        parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
        parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty();
    }
}

$var = ($this->modelClass)::where('name', 'like', strtoupper("%${key}%"))->get();

MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClass::class;

$var = static::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz];
$var = self::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz];
$var = parent::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz];

$var = Order::{camel_case($name)}();
$var = Order::{"string"}();
$var = Order::{1}();
$var = Order::{__FILE__}();
$var = Order::{true}();
$var = Order::{$var ? "foo" : "bar"}();
$var = Order::{"foo" . "bar"}();
$var = Order::{$var = "test"}();
$var = Order::{(string) $var = 1111}();
$var = Order::{(string)["test"]}();
$var = Order::{$var}();
$var = Order::{$$var}();

$var = ($var[0])::foo;
$var = ($var[0][1])::foo;
$var = ($var[0])[1]::foo;
$var = (($var[0])[1])::foo;
$var = (new Foo())::bar;
$var = (Foo::$bar)['baz']();
$var = Foo::$bar['baz']();
$var = Foo::{$bar['baz']}();
$var = Foo::$bar['baz']();

get_class($this->resource)::$wrap;

$var = (Foo::$bar)['baz']();

$var = get_class($var)::property;
$var = get_class($var)::$property;
$var = get_class($var)::$$property;
$var = get_class($var)::$$$property;
$var = get_class($var)::$$$$property;
$var = get_class($var)::$$$$$property;

$var = $bar->{$property->foo};
// TODO https://github.com/glayzzle/php-parser/issues/254
// $var = $bar->${$property};
$var =  $bar->foo_{$property};
